package low;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

/**
 * 645. 错误的集合
 */
public class FindErrorNums {
    public static int[] stringToIntegerArray(String input) {
        input = input.trim();
        input = input.substring(1, input.length() - 1);
        if (input.length() == 0) {
            return new int[0];
        }

        String[] parts = input.split(",");
        int[] output = new int[parts.length];
        for(int index = 0; index < parts.length; index++) {
            String part = parts[index].trim();
            output[index] = Integer.parseInt(part);
        }
        return output;
    }

    public static String integerArrayToString(int[] nums, int length) {
        if (length == 0) {
            return "[]";
        }

        String result = "";
        for(int index = 0; index < length; index++) {
            int number = nums[index];
            result += Integer.toString(number) + ", ";
        }
        return "[" + result.substring(0, result.length() - 2) + "]";
    }

    public static String integerArrayToString(int[] nums) {
        return integerArrayToString(nums, nums.length);
    }

    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String line;
        while ((line = in.readLine()) != null) {
            int[] nums = stringToIntegerArray(line);

            int[] ret = new Solution().findErrorNums(nums);

            String out = integerArrayToString(ret);

            System.out.print(out);
        }
    }


    static class Solution {
        public int[] findErrorNums(int[] nums) {
            Arrays.sort(nums);
            int[] error = new int[2];
            int n = nums.length;
            if (nums[0]!=1){
                error[1] = 1;
            }
            if (nums[n-1]!=n){
                error[1] = n;
            }
            for (int i=0;i<n;i++){
                if (i+1<n){
                    if (nums[i+1]-nums[i]==1){
                        continue;
                    }else if (nums[i+1]-nums[i]==0){
                        error[0] = nums[i];
                        if (error[1]!=0){
                            return error;
                        }
                    }else if (nums[i+1]-nums[i]==2){
                        error[1] = nums[i]+1;
                        if (error[0]!=0){
                            return error;
                        }
                    }
                }
            }
            return error;
        }
    }
}
